/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: user
 * Date: 2024-04-30
 * Time: 16:52
 */
public class Test {
//    public static void main(String[] args) {
//        int a = 10;
//        int b = 20;
//        System.out.println("第一次调用方法之前");
//        int ret = add(a, b);
//        System.out.println("第一次调用方法之后");
//        System.out.println("ret = " + ret);
//        System.out.println("第二次调用方法之前");
//        ret = add(30, 50);
//        System.out.println("第二次调用方法之后");
//        System.out.println("ret = " + ret);
//    }
//    public static int add(int x, int y) {
//        System.out.println("调用方法中 x = " + x + " y = " + y);
//        return x + y;
//    }

//    public static void main(String[] args) {
//        int a = 10;
//        int b = 20;
//        swap(a, b);
//        System.out.println("main: a = " + a + " b = " + b);
//    }
//    public static void swap(int x, int y) {
//        int tmp = x;
//        x = y;
//        y = tmp;
//        System.out.println("swap: x = " + x + " y = " + y);
//    }
//public static void main(String[] args) {
//    int[] arr = {10, 20};
//    swap(arr);
//    System.out.println("arr[0] = " + arr[0] + " arr[1] = " + arr[1]);
//}
//    public static void swap(int[] arr) {
//        int tmp = arr[0];
//        arr[0] = arr[1];
//        arr[1] = tmp;
//    }
public static void main(String[] args) {
    add(1, 2);               // 调用add(int, int)
    add(1.5, 2.5);           // 调用add(double, double)
    add(1.5, 2.5, 3.5);   // 调用add(double, double, double)
}
    public static int add(int x, int y) {
        System.out.println("调用add(int x,int y)函数");
        return x + y;
    }
    public static double add(double x, double y) {
        System.out.println("调用add(double x,double y)函数");
        return x + y;
    }
    public static double add(double x, double y, double z) {
        System.out.println("调用add(double x,double y,double z)函数");
        return x + y + z;
    }

}
